﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartWMS.Common.Extensions;
using SmartWMS.Common.ResponseOutput;
using SmartWMS.Domain.BasicsDatum;
using SmartWMS.Server.BasicsDatumServer.ProductManagement;
using SmartWMS.Server.BasicsDatumServer.ProductManagement.Dto;
using Z.EntityFramework.Plus;

namespace SmartWMS.API.Controllers.BasicsDatumMange
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductManagementController : ControllerBase
    {
        private readonly IProductManagement _productManagement;

        public ProductManagementController(IProductManagement productManagement)
        {
            _productManagement = productManagement;
        }

        /// <summary>
        /// 产品管理列表
        /// </summary>
        /// <param name="productManagementDto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Response<dynamic> ProductManagementGetList(ProductSelectDto productSelectDto)
        {
            return _productManagement.ProductManagementGetList(productSelectDto);
        }


        /// <summary>
        /// 批量删除产品
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<Response<bool>> DeletesProductManagementIsDisable(ProductManagementDto dto)
        {
            return _productManagement.DeletesProductManagementIsDisable(dto);
        }

        /// <summary>
        /// 产品管理删除
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<Response<bool>> DeleteProductManagementDtoAsyne(ProductManagementDto dto)
        {
            return _productManagement.DeleteProductManagementDtoAsyne(dto);
        }


        /// <summary>
        /// 产品管理反填
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Response<ProductManagementDto> GetProductManagementById(ProductManagementDto dto)
        {
            return _productManagement.GetProductManagementById(dto);
        }





        /// <summary>
        /// 产品管理添加
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<Response<bool>> ProductManagementDtoAddSave(ProductManagementDto dto)
        {
            return _productManagement.ProductManagementDtoAddSave(dto);
        }

        /// <summary>
        /// 产品管理修改
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<Response<bool>> ProductManagementUpdate(ProductManagementDto dto)
        {
            return _productManagement.ProductManagementUpdate(dto);
        }


        /// <summary>
        /// 加载客户
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<List<Custom>>> BindCustomAsync()
        {
            return _productManagement.BindCustomAsync();
        }

        /// <summary>
        /// 加载库位
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<List<Location>>> BindLocationAsync()
        {
            return _productManagement.BindLocationAsync();
        }

        /// <summary>
        /// 加载仓库
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<List<Warehouse>>> BindWarehouseAsync()
        {
            return _productManagement.BindWarehouseAsync();
        }

        /// <summary>
        /// 加载单位
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public async Task<Response<List<Unit>>> BindUnitAsync()
        {
            return await _productManagement.BindUnitAsync();
        }

        
    }
}
